package com.wh.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wh.order.dao.OrderListMapper;
import com.wh.order.pojo.OrderList;
import com.wh.order.service.IOrderListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wh.order.pojo.OrderDetail;
import com.wh.order.service.IOrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wh.order.mapper.OrderDetailMapper;
import com.wh.order.dto.OrderDetailDto;

import java.util.Arrays;
import java.util.List;

/**
 * 业务实现类：
 */
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements IOrderDetailService {

    @Autowired
    private OrderDetailMapper orderDetailMapper;
    @Override
    public IPage<OrderDetail>findByPage(OrderDetailDto orderDetailDto){
        //1.创建查询条件
        QueryWrapper<OrderDetail> qw = new QueryWrapper<>();
        //qw.like("xxx",orderDetailDto.getXxx());
        //qw.or();
        //qw.like("xxx",orderDetailDto.getXxx());
        //2.组件分页数据
        IPage<OrderDetail> page = new Page<>(orderDetailDto.getCurrentPage(), orderDetailDto.getPageSize());
        page.setRecords(orderDetailMapper.findByPage(page,qw));
        page.setTotal(orderDetailMapper.selectCount(qw));
        //3.返回
        return page;
    }


}
